package StudyCode.summary.mydatetime;

import java.time.LocalTime;
import java.time.ZonedDateTime;
import java.time.temporal.TemporalQueries;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class LocalTimeFromZonedDateTime {
	public static void main(String[] args) {
		ZonedDateTime zdt = ZonedDateTime.now();

		LocalTime lt1 = zdt.toLocalTime();

		LocalTime lt2 = LocalTime.from(zdt);

		LocalTime lt3 = zdt.query(TemporalQueries.localTime());

		LocalTime lt4 = zdt.query(LocalTime::from);

		int hours = zdt.getHour();
		int minutes = zdt.getMinute();
		int seconds = zdt.getSecond();
		int nanos = zdt.getNano();
		LocalTime lt5 = LocalTime.of(hours, minutes, seconds, nanos);

		System.out.println("lt1: " + lt1);
		System.out.println("lt2: " + lt2);
		System.out.println("lt3: " + lt3);
		System.out.println("lt4: " + lt4);
		System.out.println("lt5: " + lt5);
	}
}
